package com.example.netcamerastreamdemo

import android.os.Bundle
import android.view.SurfaceView
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity

class PlayerTestActivity : AppCompatActivity() {
    private val TAG = "PlayerTestActivity"

    lateinit var mVideoStreamPlayer : VideoStreamPlayer

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_player_test)
        val surfaceView = findViewById<SurfaceView>(R.id.surface_view)
        val msgData = VideoStreamPlayer.MsgData()
        msgData.dev_guid = "63-00F628C3B402-9A2A"
        msgData.video_chnn = 9
        msgData.sub_chnn = 2
        msgData.rec_path = "63-00F628C3B402-9A2A\\\\1623202389634\\\\63-00F628C3B402-9A2A_9_1623202389634"

        mVideoStreamPlayer = VideoStreamPlayer(
            surfaceView,
            "wss://shike-qa.video110.cn/nsdk",
            msgData
        )
        mVideoStreamPlayer.prepare()
        val playBtn = findViewById<Button>(R.id.play_btn)
        val stopBtn = findViewById<Button>(R.id.stop_btn)
        playBtn.setOnClickListener {
            mVideoStreamPlayer.startPlay()
        }
        stopBtn.setOnClickListener {
            mVideoStreamPlayer.stopPlay()
        }
    }
}